package com.huya.mapper;

import com.huya.pojo.entity.TestRecord;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface TestRecordMapper {
    @Select("SELECT * FROM test_records WHERE user_id = #{userId}")
    List<TestRecord> getRecordsByUserId(Long userId);
//
//    @Insert("INSERT INTO test_records(record_id, user_id, test_id, start_time, end_time, total_score, result_level) " +
//            "VALUES(#{recordId}, #{userId}, #{testId}, #{startTime}, #{endTime}, #{totalScore}, #{resultLevel})")
    void insert(TestRecord testRecord);

    @Select("SELECT * FROM test_records WHERE record_id = #{recordId}")
    TestRecord findRecordById(String recordId);

//    @Update("UPDATE test_records SET end_time = #{endTime}, total_score = #{totalScore}, result_level = #{resultLevel} " +
//            "WHERE record_id = #{recordId}")
    void update(TestRecord testRecord);
}
